<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学生班级相关测试</title>
<%@ include file="/common/commonLib.jsp" %>
</head>
<body>
<center>
学生id<input type="text" name="studentId" /><br>
班级id<input type="text" name="classId" /><br>
<button id="addClassStudent">提交</button>
</center><br>
<hr><br>
<center>
<button id="batchAddClassStudent">批量添加</button>
</center>
</body>
<script>
$(document).ready(function(){
	 $("#addClassStudent").on("click",addClassStudent);  
	 $("#batchAddClassStudent").on("click",batchAddClassStudent);  
})

var batchAddClassStudent=function (){
	var json={
			classId:8,
			studentId:[2,3]
	}
	$.post(CONTEXT_PATH+"cscontrol/ajaxBatchCreate", {
		data : JSON.stringify(json)
	}, function(json) {
		alert(JSON.stringify(json));
	});
}

var addClassStudent= function (){
	var studentId=$("input[name='studentId']").val();
	var classId=$("input[name='classId']").val();
	var json={
			studentId:studentId,
			classId:classId
	}
	$.post(CONTEXT_PATH+"cscontrol/ajaxCreate", {
		data : JSON.stringify(json)
	}, function(json) {
		alert(JSON.stringify(json));
	});
}
</script>
</html>